function js_test_pure_test()
{
    print('js_test_pure_test');
    pdata = {};
    post_ajax_js(pdata, "/rpc/test/", post_callback);
}

function js_test_create_task()
{
    print('js_test_create_task');
    post_create_task('this is a test(js_test_create_task)', 
                  get_time(), get_time() + 86400,
                  'description_none', post_callback);
}

function js_test_commit_task()
{
    print('js_test_commit_task', post_callback);
    post_commit_name('xxx_id_ggg', 'new name', post_callback);
    post_commit_duetime('xxx_id_ggg', get_time(), post_callback);
    post_commit_remidertime('xxx_id_ggg', get_time(), post_callback);
    post_commit_all('xxx_id_ggg', 'new name', get_time(), get_time(), post_callback);
}

function js_test_get_task()
{
    print('js_test_get_task');
    post_get_task('xxx_id_ggg', post_callback);
}

function js_test_list_task()
{
    print('js_test_list_task');
    post_list_owner_task('spike', post_callback);
}


function post_callback(jobj)
{
    if (jobj['success'])
    {
        print('<b>SUCCESS</b>');
    }
    else
    {
        print('<b>FAIL</b>');
    }
    buf = ''
    $.each(jobj, function(k, v) {
            buf += k + ':' + v + '  ';
        });
        
    print(buf);
}

function test()
{
    js_test_pure_test();
    js_test_create_task();
    js_test_commit_task();
    js_test_get_task();
    js_test_list_task();
}

function init()
{
    test();
}

function print(val)
{
    $("#output").append("<p>" + val + "</p>");
}

$(document).ready(init);
